package po.tree;

/**
 * Created by guowei on 2019/6/9.
 */
public class Position {
    private int level;
    private int index;

    public Position(int level, int index) {
        this.level = level;
        this.index = index;
    }

    public int getLevel() {
        return level;
    }

    public int getIndex() {
        return index;
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = result*31 + this.level;
        result = result*31 + this.index;
        return result;
    }

    @Override
    public boolean equals(Object p) {
        if(!(p instanceof Position)) {
            return false;
        }
        Position pos = (Position)p;
        return this.level == pos.getLevel() && this.index == pos.getIndex();
    }
}
